package com.myproject.thread.join;

public class Test1 {

    public static void main(String[] args) throws InterruptedException {

        //正确示范
        //先start 再join，活着的线程join才有意义，死了的线程join不会阻塞
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread()+" run");
            }
        });

        t.start();
        System.out.println(t.isAlive());
        t.join();
        System.out.println(Thread.currentThread()+" over");
    }
}
